<template>
	<view class="box" :class="{hide:hide==true}">
		<image :src="src" class="img" mode="widthFix"></image>
		<view class="close" @click="showdel=true">x</view>
		<u-modal v-model="showdel" :show-cancel-button="true" @confirm="confirmdel" content="你确定要删除吗?"></u-modal>
	</view>
</template>

<script>
	export default {
		props: {
			imgtype: {
				tpye: String
			},
			imgid: {
				tpye: String
			},
			src: {
				type: String
			}
		},
		data() {
			return {
				hide: false,
				showdel: false
			};
		},
		methods: {
			confirmdel() { 
				uni.$emit('delimg', {
					imgtype: this.imgtype,
					imgid: this.imgid
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.hide {
		display: none;
	}

	.box {
		position: relative;
		border: 1rpx dashed #ff0000;
		margin: 0rpx; 
		border-width: 3rpx;
	}

	.img {
		width: 100%; 
	}

	.close {
		position: absolute;
		right: 15rpx;
		color: #ff0000;
		top: 0rpx;
		font-size: 40rpx;
	}
</style>
